Displaying a "Wait" Message While a Branch Expands

Description

This example shows how to use the {EXPAND} command to display a wait message while waiting for the data to expand a branch of a tree control. The list that defines the tree control's contents includes the {EXPAND} command where Alpha Anywhere may require several seconds to general the branches of the tree. This occurs only when dynamically populating the tree control with a function.

list = <<%list%
scripts|{EXPAND=Expanding folder...}!get_scripts()
functions|{EXPAND=Expanding folder...}!a5.udf_enum(2)
colors|{EXPAND=Expanding folder...}!a5.color_enum()
tables|{EXPAND=Expanding folder...}!a5.table_enum()
%list%

The X directive in the tree control syntax says that functions will be providing the contents of the branches of the tree. The D directive says that the "|" character separates the parent node from the function that defines its branches.

[%X;S=BRL;D="|";%.60,15current^<list];

It is very important that the function that expands the branch include the UI_YIELD()function call. The UI_YIELD()call allows Alpha Anywhere to update the screen while the function is still executing. Without the UI_YIELD()in this function, the text in the {EXPAND} directive would not be painted onto the screen.

function get_scripts as C ()
hourglass_cursor(.t.)
ui_yield()
sleep(2)
get_scripts = a5.script_enum(2)
hourglass_cursor(.f.)
end function

Limitations

Desktop applications only.

See Also